<?php

	require_once('common/includes/defines.php');
	require_once('common/includes/globals.php');
	require_once('config.php');
	
	require_once('common/includes/class.session.php');
	require_once('common/includes/class.db.php');
	require_once('common/includes/class.usergroup.php');
	require_once('common/includes/class.user.php');
	require_once 'libs/Smarty.class.php';

        
        
	// start session management
	//session::init();
	
	/*
	if (isset($_SESSION[SESSION_USERNAME]))
    {
        echo "Nutzer schon eingeloggt";
    }
	*/
	
	/*
	if(user::register("asd","asd"))
	{
		echo "registration complete";
	}
	*/
	
	if ($_POST['Logoff']) {
		Session::destroy();
	}
	
	$Login = "";
	$Password = "";
	if ($_POST['Login'] && $_POST['LoginName'] && $_POST['Password']) {
		$Login = $_POST['LoginName'];
		$Password = $_POST['Password'];
	}
	
	
	
	//$CurUser = new user($cfg, "Thomas", "testpw");
	$CurUser = new user($Login, $Password);

        //// Template Engine wird vorbereitet ///
        $smarty = new Smarty();
	$smarty->compile_check = true;
	$smarty->compile_dir = 'templates_c';
	$smarty->debugging = true;
        

		//// Benutzer an smarty �bergeben ///
        $smarty->assign('user',$CurUser);

        //// Header begin////
        $smarty->assign('css_dir','templates/css');
        $header = $smarty->fetch('header.html');
        //// Header end////

        //// Menu begin////
        $menu = $smarty->fetch('menu.html');
        //// Menu begin////

       //// Content - Inhalte werden eingebunden - begin///
        include 'content.php';
       //// Content - Inhalte werden eingebunden - end///

        //// Footer begin////
        $footer = $smarty->fetch('footer.html');
        //// Menu end////

        echo $header.$menu.$content.$footer;

?>
